import Vue from "vue";
import VueRouter from "vue-router";
import Detail from "@/views/detail.vue";
import Layout from "@/views/layout.vue";
import Login from "@/views/login.vue";
import Register from "@/views/register.vue";
import Like from "@/views/like";
import Article from "@/views/article";
import Collect from "@/views/collect";
import User from "@/views/user";
Vue.use(VueRouter);

const routes = [
  {
    path: "/login",
    component: Login,
  },
  {
    path: "/article/:id",
    component: Detail,
  },
  {
    path: "/register",
    component: Register,
  },
  {
    path: "/",
    component: Layout,
    redirect: "/article",
    children: [
      { path: "/article", component: Article },
      { path: "/like", component: Like },
      { path: "/collect", component: Collect },
      { path: "/user", component: User },
    ],
  },
];

const router = new VueRouter({
  routes,
});

export default router;
